import axios from 'axios';

export interface PersonVo {
  id: string;
  address: string;
  cardId: string;
  email: string;
  firstEdu: string;
  gender: string;
  highEdu: string;
  name: string;
  namePinyin: string;
  officePhone: string;
  phone: string;
  postCode: string;
  sysInnerFlag: string;
  type: string;
  age: string;
}

// extends Partial<PersonVo>
export interface PolicyParams {
  name: string;
  page: number;
  phone: string;
  rows: number;
  keywords?: string;
}

export interface PolicyListRes {
  rows: PersonVo[];
  total: number;
}

export function queryPolicyList(params: PolicyParams) {
  return axios.post<PolicyListRes>('tenant/person/query', params);
}

export function createPerson(params: PersonVo) {
  return axios.post<string>('tenant/person/create', params);
}

export function updatePerson(params: PersonVo) {
  return axios.post<string>('tenant/person/update', params);
}

export function delPerson(id: string) {
  return axios.post<string>(`tenant/person/delete/${id}`);
}
